#!/bin/sh


PROJECT_NAME='Demo1 Executor'

BUILD_PATH=/data/app/demo
IMAGE_NAME=registry.zhuyc.com:5000/zhuyc/demo1
NEW_VERSION=$1



build_image() {

    echo 'Start to build the new version '$PROJECT_NAME' docker image. Version:'$NEW_VERSION
    
	cd $BUILD_PATH
	
    docker build -t $IMAGE_NAME:$NEW_VERSION .

    echo 'Finished to build '$PROJECT_NAME' docker image. Version:'$NEW_VERSION

}

main() {

    if [ ! -n "$NEW_VERSION" ]; then

        echo 'The version parameter is empty.'

        exit -1

    fi

    build_image 

}


main
